/**
 *    Copyright (C) 2025-present MongoDB, Inc.
 *
 *    This program is free software: you can redistribute it and/or modify
 *    it under the terms of the Server Side Public License, version 1,
 *    as published by MongoDB, Inc.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    Server Side Public License for more details.
 *
 *    You should have received a copy of the Server Side Public License
 *    along with this program. If not, see
 *    <http://www.mongodb.com/licensing/server-side-public-license>.
 *
 *    As a special exception, the copyright holders give permission to link the
 *    code of portions of this program with the OpenSSL library under certain
 *    conditions as described in each individual source file and distribute
 *    linked combinations including the program with the OpenSSL library. You
 *    must comply with the Server Side Public License in all respects for
 *    all of the code used other than as permitted herein. If you modify file(s)
 *    with this exception, you may extend this exception to your version of the
 *    file(s), but you are not obligated to do so. If you do not wish to do so,
 *    delete this exception statement from your version. If you delete this
 *    exception statement from all source files in the program, then also delete
 *    it in the license file.
 */

#include "mongo/db/pipeline/document_source_bucket_auto.h"
#include "mongo/db/pipeline/document_source_facet.h"
#include "mongo/db/pipeline/document_source_graph_lookup.h"
#include "mongo/db/pipeline/document_source_group.h"
#include "mongo/db/pipeline/document_source_internal_projection.h"
#include "mongo/db/pipeline/document_source_internal_replace_root.h"
#include "mongo/db/pipeline/document_source_list_mql_entities.h"
#include "mongo/db/pipeline/document_source_lookup.h"
#include "mongo/db/pipeline/document_source_plan_cache_stats.h"
#include "mongo/db/pipeline/document_source_skip.h"
#include "mongo/db/pipeline/document_source_streaming_group.h"
#include "mongo/db/pipeline/document_source_union_with.h"
#include "mongo/db/pipeline/optimization/rule_based_rewriter.h"

namespace mongo::rule_based_rewrites::pipeline {

REGISTER_RULES(DocumentSourceSkip,
               OPTIMIZE_AT_RULE(DocumentSourceSkip),
               OPTIMIZE_IN_PLACE_RULE(DocumentSourceSkip));
REGISTER_RULES(DocumentSourceListMqlEntities, OPTIMIZE_AT_RULE(DocumentSourceListMqlEntities));
REGISTER_RULES(DocumentSourceLimit, OPTIMIZE_AT_RULE(DocumentSourceLimit));
REGISTER_RULES(DocumentSourceGroup,
               OPTIMIZE_AT_RULE(DocumentSourceGroup),
               OPTIMIZE_IN_PLACE_RULE(DocumentSourceGroup));
REGISTER_RULES(DocumentSourceLookUp, OPTIMIZE_AT_RULE(DocumentSourceLookUp));
REGISTER_RULES(DocumentSourceUnionWith,
               OPTIMIZE_AT_RULE(DocumentSourceUnionWith),
               OPTIMIZE_IN_PLACE_RULE(DocumentSourceUnionWith));
REGISTER_RULES(DocumentSourcePlanCacheStats, OPTIMIZE_AT_RULE(DocumentSourcePlanCacheStats));
REGISTER_RULES(DocumentSourceUnwind, OPTIMIZE_AT_RULE(DocumentSourceUnwind));
REGISTER_RULES(DocumentSourceInternalReplaceRoot,
               OPTIMIZE_AT_RULE(DocumentSourceInternalReplaceRoot));
REGISTER_RULES(DocumentSourceGraphLookUp, OPTIMIZE_AT_RULE(DocumentSourceGraphLookUp));
REGISTER_RULES(DocumentSourceInternalProjection,
               OPTIMIZE_AT_RULE(DocumentSourceInternalProjection));
REGISTER_RULES(DocumentSourceSort, OPTIMIZE_AT_RULE(DocumentSourceSort));
REGISTER_RULES(DocumentSourceBucketAuto, OPTIMIZE_IN_PLACE_RULE(DocumentSourceBucketAuto));
REGISTER_RULES(DocumentSourceFacet, OPTIMIZE_IN_PLACE_RULE(DocumentSourceFacet));
REGISTER_RULES(DocumentSourceStreamingGroup, OPTIMIZE_IN_PLACE_RULE(DocumentSourceStreamingGroup));

}  // namespace mongo::rule_based_rewrites::pipeline
